#include "sortfactory.h"
#include "bubblesort.h"
#include "insertsort.h"
#include "mergesort.h"
#include "quicksort.h"
#include "selectsort.h"
#include "shellsort.h"

SortBase *SortFactory::generateMethod(int id, QObject *parent)
{
    switch (id) {
    case 0:
        return new BubbleSort(parent);
    case 1:
        return new QuickSort(parent);
    case 2:
        return new InsertSort(parent);
    case 3:
        return new SelectSort(parent);
    case 4:
        return new MergeSort(parent);
    case 5:
        return new ShellSort(parent);
    default:
        return nullptr;
    }
}

QStringList SortFactory::typeList()
{
    return QStringList{"冒泡排序", "快速排序", "插入排序", "选择排序", "归并排序", "希尔排序"};
}
